home *** CD-ROM | disk | FTP | other *** search
/ C & C++ Multimedia Cyber Classroom / C and C++ Multimedia Cyber Classroom (Prentice Hall) (1998).iso / src / fig05_34.jar / Ch05 / Fig05_34 / Fig05_34.cpp next >
C/C++ Source or Header  |  1997-10-14  |  504b  |  23 lines

  1. // Fig. 5.34: fig05_34.cpp
  2. // Using strlen
  3. #include <iostream.h>
  4. #include <string.h>
  5.  
  6. int main()
  7. {
  8.    char *string1 = "abcdefghijklmnopqrstuvwxyz";
  9.    char *string2 = "four";
  10.    char *string3 = "Boston";
  11.  
  12.    cout << "The length of \"" << string1
  13.         << "\" is " << strlen( string1 )
  14.         << "\nThe length of \"" << string2
  15.         << "\" is " << strlen( string2 )
  16.         << "\nThe length of \"" << string3
  17.         << "\" is " << strlen( string3 ) << endl;
  18.  
  19.    return 0;
  20. }
  21.  
  22.  
  23.